package top.forgirl;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.forgirl.annotation.ErrorLog;
import top.forgirl.exception.ForgirlException;
import top.forgirl.result.Result;
import top.forgirl.result.ResultEnum;

@RestControllerAdvice
@ErrorLog
public class GlobalExceptionHandler {

    @ExceptionHandler(ForgirlException.class)
    public Result<String> handlerForgirlException(ForgirlException e) {
        return new Result<>(ResultEnum.FAILED, "系统内部错误，请联系管理员");
    }

//    @ExceptionHandler(Exception.class)
//    public Result<String> handlerException(Exception e) {
//        return new Result<>(ResultEnum.FAILED, "未知错误，请反馈给管理员");
//    }
}
